/* Shared BIG-ABE accessibility widget and display preferences. */

:root {
  --a11y-widget-size: 58px;
  --a11y-widget-edge: clamp(14px, 2.2vw, 26px);
  --a11y-widget-bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  --a11y-widget-blue: #3f63ff;
  --a11y-widget-blue-dark: #253fd4;
  --a11y-panel-ink: #07111f;
}

.accessibility-widget {
  position: fixed;
  right: var(--a11y-widget-edge);
  bottom: var(--a11y-widget-bottom);
  z-index: 9000;
  color: var(--a11y-panel-ink);
  font-family: var(--font-body, var(--abe-font, Arial, Helvetica, sans-serif));
}

.accessibility-widget.a11y-home-offset {
  --a11y-widget-bottom: calc(var(--bottom-nav-height, 0px) + env(safe-area-inset-bottom, 0px) + 18px);
  --a11y-panel-top-clearance: calc(var(--topbar-height, 0px) + var(--nav-height, 0px) + 12px);
}

.accessibility-widget.a11y-home-offset .accessibility-panel {
  top: var(--a11y-panel-top-clearance);
  bottom: calc(var(--a11y-widget-bottom) + var(--a11y-widget-size) + 14px);
  max-height: none;
}

.accessibility-toggle {
  width: var(--a11y-widget-size);
  height: var(--a11y-widget-size);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 999px;
  background: #fff;
  color: #052c66;
  cursor: pointer;
  overflow: hidden;
  box-shadow:
    0 18px 40px rgba(3, 8, 20, 0.38),
    0 0 0 1px rgba(8, 18, 42, 0.18);
  transition: transform 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease;
}

.accessibility-toggle-icon {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 999px;
  object-fit: cover;
}

.accessibility-toggle:hover,
.accessibility-toggle:focus-visible {
  background: #fff;
  outline: none;
  transform: translateY(-2px);
  box-shadow:
    0 20px 44px rgba(3, 8, 20, 0.42),
    0 0 0 5px rgba(5, 44, 102, 0.24);
}

.accessibility-panel[hidden] {
  display: none;
}

.accessibility-panel {
  position: fixed;
  right: var(--a11y-widget-edge);
  bottom: calc(var(--a11y-widget-bottom) + var(--a11y-widget-size) + 14px);
  z-index: 9001;
  width: min(430px, calc(100vw - 28px));
  max-height: min(640px, calc(100svh - var(--a11y-widget-bottom) - var(--a11y-widget-size) - 42px));
  overflow-y: auto;
  color: var(--a11y-panel-ink);
  overscroll-behavior: contain;
}

.accessibility-panel-card {
  position: relative;
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(7, 17, 31, 0.16);
  border-left: 4px solid var(--a11y-widget-blue);
  background: #fff;
  box-shadow: 0 26px 72px rgba(3, 8, 20, 0.34);
}

.accessibility-panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding-right: 48px;
}

.accessibility-panel-kicker,
.accessibility-section-title {
  margin: 0;
  color: var(--a11y-widget-blue-dark);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

.accessibility-panel h2 {
  margin: 5px 0 0;
  color: var(--a11y-panel-ink);
  font-family: var(--font-display, var(--abe-font-condensed, Arial, Helvetica, sans-serif));
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 0.98;
  text-transform: uppercase;
}

.accessibility-close,
.accessibility-reset,
.accessibility-control {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(7, 17, 31, 0.18);
  border-radius: 4px;
  background: #f6f8fb;
  color: var(--a11y-panel-ink);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1.05;
  text-align: center;
  text-transform: uppercase;
}

.accessibility-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  background: #fff;
  font-size: 1.25rem;
  line-height: 1;
}

.accessibility-control-section {
  display: grid;
  gap: 9px;
}

.accessibility-control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.accessibility-control-grid.is-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.accessibility-control[aria-pressed="true"] {
  background: var(--a11y-panel-ink);
  border-color: var(--a11y-panel-ink);
  color: #fff;
  box-shadow: inset 0 0 0 2px var(--a11y-widget-blue);
}

.accessibility-panel-actions {
  display: grid;
  grid-template-columns: 1fr;
}

.accessibility-reset {
  min-height: 44px;
  background: #07111f;
  border-color: #07111f;
  color: #fff;
}

.accessibility-close:hover,
.accessibility-reset:hover,
.accessibility-control:hover {
  background: var(--a11y-widget-blue);
  border-color: var(--a11y-widget-blue);
  color: #fff;
}

.accessibility-close:focus-visible,
.accessibility-reset:focus-visible,
.accessibility-control:focus-visible {
  border-color: var(--a11y-widget-blue);
  color: var(--a11y-panel-ink);
  outline: none;
  box-shadow: 0 0 0 3px rgba(63, 99, 255, 0.32);
}

.accessibility-close:focus-visible,
.accessibility-control:focus-visible {
  background: #f6f8fb;
}

.accessibility-reset:focus-visible {
  background: #07111f;
  color: #fff;
}

.accessibility-control[aria-pressed="true"]:focus-visible {
  background: var(--a11y-panel-ink);
  color: #fff;
}

html.a11y-large-text {
  font-size: 112%;
}

html.a11y-increased-spacing body,
html.a11y-increased-spacing p,
html.a11y-increased-spacing li,
html.a11y-increased-spacing label,
html.a11y-increased-spacing input,
html.a11y-increased-spacing select,
html.a11y-increased-spacing textarea {
  line-height: 1.75 !important;
}

html.a11y-underline-links a:not(.btn):not(.hero-cta):not(.coverage-btn):not(.map-state-btn):not(.back-to-top):not(.accessibility-toggle):not(.site-btn) {
  text-decoration: underline !important;
  text-decoration-thickness: 2px !important;
  text-underline-offset: 4px !important;
}

html.a11y-focus-guide *:focus-visible {
  outline: 3px solid #ffd84d !important;
  outline-offset: 4px !important;
  box-shadow: 0 0 0 7px rgba(0, 0, 0, 0.58) !important;
}

html.a11y-reduced-motion *,
html.a11y-reduced-motion *::before,
html.a11y-reduced-motion *::after {
  scroll-behavior: auto !important;
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

html.a11y-dark-theme {
  --abe-paper: #0b0f14;
  --abe-paper-2: #111827;
  --abe-ink: #f8fafc;
  --abe-muted: #d7dde6;
}

html.a11y-light-contrast {
  --abe-paper: #fff;
  --abe-paper-2: #fff;
  --abe-ink: #000;
  --abe-muted: #111827;
}

html.a11y-high-contrast {
  --abe-paper: #000;
  --abe-paper-2: #000;
  --abe-ink: #fff;
  --abe-muted: #fff;
}

html.a11y-dark-theme body,
html.a11y-dark-theme main,
html.a11y-dark-theme body :is(main > section, article, aside, footer, .content-section, .dark-band, .service-hero, .service-info-hero, .capability-card, .hero-panel, .service-info-contact-panel, .core-provider-shell, .core-proof-item, .core-service-card, .brand-category-card, .service-map-card, .site-footer):not(.accessibility-panel):not(.accessibility-panel *) {
  background: #0b0f14 !important;
  color: #f8fafc !important;
}

html.a11y-light-contrast body,
html.a11y-light-contrast main,
html.a11y-light-contrast body :is(main > section, article, aside, footer, .content-section, .dark-band, .service-hero, .service-info-hero, .capability-card, .hero-panel, .service-info-contact-panel, .core-provider-shell, .core-proof-item, .core-service-card, .brand-category-card, .service-map-card, .site-footer):not(.accessibility-panel):not(.accessibility-panel *) {
  background: #fff !important;
  color: #000 !important;
}

html.a11y-high-contrast body,
html.a11y-high-contrast main,
html.a11y-high-contrast body :is(main > section, article, aside, footer, header, nav, .topbar, .navbar, .nav-links, .site-topbar, .site-nav, .content-section, .dark-band, .service-hero, .service-info-hero, .capability-card, .hero-panel, .service-info-contact-panel, .core-provider-shell, .core-proof-item, .core-service-card, .brand-category-card, .service-map-card, .site-footer):not(.accessibility-panel):not(.accessibility-panel *) {
  background: #000 !important;
  color: #fff !important;
  border-color: #fff !important;
  box-shadow: none !important;
}

html.a11y-dark-theme body :is(h1, h2, h3, h4, h5, h6, p, li, span, strong, label, legend, a):not(.accessibility-panel *),
html.a11y-high-contrast body :is(h1, h2, h3, h4, h5, h6, p, li, span, strong, label, legend, a):not(.accessibility-panel *) {
  color: #fff !important;
  text-shadow: none !important;
}

html.a11y-light-contrast body :is(h1, h2, h3, h4, h5, h6, p, li, span, strong, label, legend, a):not(.accessibility-panel *) {
  color: #000 !important;
  text-shadow: none !important;
}

html.a11y-high-contrast body a:not(.accessibility-toggle):not(.accessibility-panel *) {
  color: #ffe66d !important;
}

html.a11y-high-contrast body :is(.btn, .site-btn, .hero-cta, .coverage-btn, button):not(.accessibility-toggle):not(.accessibility-panel *) {
  background: #000 !important;
  border-color: #fff !important;
  color: #fff !important;
}

html.a11y-dark-theme body .hero::after,
html.a11y-dark-theme body .service-hero::before,
html.a11y-dark-theme body .service-info-hero::after,
html.a11y-light-contrast body .hero::after,
html.a11y-light-contrast body .service-hero::before,
html.a11y-light-contrast body .service-info-hero::after,
html.a11y-high-contrast body .hero::after,
html.a11y-high-contrast body .service-hero::before,
html.a11y-high-contrast body .service-info-hero::after {
  background: transparent !important;
}

html.a11y-saturation-high {
  --a11y-saturation-filter: saturate(1.75) contrast(1.08);
}

html.a11y-monochrome {
  --a11y-saturation-filter: grayscale(1);
}

html.a11y-saturation-low {
  --a11y-saturation-filter: saturate(0.42);
}

html:is(.a11y-saturation-high, .a11y-monochrome, .a11y-saturation-low) body :is(
  .hero .abe-hero-service-mosaic,
  .hero .hero-grid,
  main > section:not(.hero),
  body > footer,
  .site-footer
):not(.accessibility-panel):not(.accessibility-panel *) {
  filter: var(--a11y-saturation-filter);
}

html.a11y-saturation-high body :is(.topbar, .navbar, .nav-links, .hero-license-band),
html.a11y-monochrome body :is(.topbar, .navbar, .nav-links, .hero-license-band),
html.a11y-saturation-low body :is(.topbar, .navbar, .nav-links, .hero-license-band) {
  filter: none !important;
}

html[data-a11y-text-color="blue"] body :is(p, li, span, label, legend, input, select, textarea, td, th, small, strong):not(.accessibility-panel *),
html[data-a11y-text-color="blue"] body a:not(.accessibility-toggle):not(.accessibility-panel *) {
  color: #005fcc !important;
}

html[data-a11y-text-color="yellow"] body :is(p, li, span, label, legend, input, select, textarea, td, th, small, strong):not(.accessibility-panel *),
html[data-a11y-text-color="yellow"] body a:not(.accessibility-toggle):not(.accessibility-panel *) {
  color: #7a4d00 !important;
}

html[data-a11y-text-color="white"] body :is(p, li, span, label, legend, input, select, textarea, td, th, small, strong):not(.accessibility-panel *),
html[data-a11y-text-color="white"] body a:not(.accessibility-toggle):not(.accessibility-panel *) {
  color: #fff !important;
}

html[data-a11y-title-color="blue"] body :is(h1, h2, h3, h4, h5, h6, .section-title, .kicker, .section-kicker):not(.accessibility-panel *) {
  color: #0067d8 !important;
}

html[data-a11y-title-color="yellow"] body :is(h1, h2, h3, h4, h5, h6, .section-title, .kicker, .section-kicker):not(.accessibility-panel *) {
  color: #8a5a00 !important;
}

html[data-a11y-title-color="white"] body :is(h1, h2, h3, h4, h5, h6, .section-title, .kicker, .section-kicker):not(.accessibility-panel *) {
  color: #fff !important;
}

html[data-a11y-background-color="cream"] body,
html[data-a11y-background-color="cream"] main,
html[data-a11y-background-color="cream"] body :is(main > section, article, aside, footer, .content-section, .dark-band, .service-hero, .service-info-hero, .capability-card, .hero-panel, .service-info-contact-panel, .core-provider-shell, .core-proof-item, .core-service-card, .brand-category-card, .service-map-card, .site-footer):not(.accessibility-panel):not(.accessibility-panel *) {
  background: #fff4c7 !important;
}

html[data-a11y-background-color="blue"] body,
html[data-a11y-background-color="blue"] main,
html[data-a11y-background-color="blue"] body :is(main > section, article, aside, footer, .content-section, .dark-band, .service-hero, .service-info-hero, .capability-card, .hero-panel, .service-info-contact-panel, .core-provider-shell, .core-proof-item, .core-service-card, .brand-category-card, .service-map-card, .site-footer):not(.accessibility-panel):not(.accessibility-panel *) {
  background: #eaf4ff !important;
}

html[data-a11y-background-color="black"] body,
html[data-a11y-background-color="black"] main,
html[data-a11y-background-color="black"] body :is(main > section, article, aside, footer, .content-section, .dark-band, .service-hero, .service-info-hero, .capability-card, .hero-panel, .core-provider-shell, .core-proof-item, .core-service-card, .brand-category-card, .service-map-card, .site-footer):not(.accessibility-panel):not(.accessibility-panel *) {
  background: #000 !important;
  color: #fff !important;
}

html[data-a11y-background-color="black"] body :is(h1, h2, h3, h4, h5, h6, p, li, span, strong, label, legend, a):not(.accessibility-panel *) {
  color: #fff !important;
}

.accessibility-widget,
.accessibility-widget *,
.accessibility-panel,
.accessibility-panel * {
  filter: none !important;
}

@media (max-width: 640px) {
  :root {
    --a11y-widget-size: 52px;
    --a11y-widget-edge: 12px;
  }

  .accessibility-panel {
    right: 10px;
    left: 10px;
    width: min(370px, calc(100vw - 20px));
    max-width: calc(100vw - 20px);
    max-height: min(600px, calc(100svh - var(--a11y-widget-bottom) - var(--a11y-widget-size) - 34px));
  }

  .accessibility-panel-card {
    gap: 13px;
    padding: 14px;
  }

  .accessibility-control-grid,
  .accessibility-control-grid.is-three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .accessibility-panel h2 {
    font-size: 1.35rem;
  }

  .accessibility-control,
  .accessibility-reset {
    min-height: 40px;
    padding-inline: 8px;
    font-size: 0.66rem;
    letter-spacing: 0.04em;
  }
}

@media (max-width: 360px) {
  :root {
    --a11y-widget-size: 48px;
    --a11y-widget-edge: 9px;
    --a11y-widget-bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
  }

  .accessibility-panel {
    right: 8px;
    left: 8px;
    bottom: calc(var(--a11y-widget-bottom) + var(--a11y-widget-size) + 10px);
  }

  .accessibility-control-grid,
  .accessibility-control-grid.is-three {
    gap: 7px;
  }
}

@media (max-width: 950px) and (max-height: 600px) and (orientation: landscape) {
  :root {
    --a11y-widget-size: 46px;
    --a11y-widget-edge: 10px;
    --a11y-widget-bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  }

  .accessibility-panel {
    width: min(520px, calc(100vw - 84px));
    max-height: calc(100svh - 22px);
    right: calc(var(--a11y-widget-edge) + var(--a11y-widget-size) + 10px);
    bottom: 10px;
  }
}
