/*
 * HelpAlong public-theme accessibility safeguards — v12.5.0
 * Loaded after page-specific public styles. The Staff Portal remains plugin-owned.
 */

:root {
  --ha-muted: #637782;
  --ha-focus-colour: #075f7a;
}

html {
  scroll-padding-top: calc(var(--ha-menu-top, 8.5rem) + 1rem);
  scroll-padding-bottom: 6rem;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

html.ha-large-text {
  --ha-font-scale: 1.125;
}

body.ha-large-text {
  font-size: 1rem;
}

body.ha-high-contrast,
html.ha-high-contrast body {
  --ha-primary: #6d004d;
  --ha-secondary: #087fa7;
  --ha-secondary-dark: #075f7a;
  --ha-navy: #001d2a;
  --ha-ink: #111;
  --ha-muted: #333;
  --ha-border: #53666f;
}

:where(h1, h2, h3, h4, h5, h6, p, li, dd, dt, figcaption, blockquote, label, legend) {
  overflow-wrap: break-word;
}

.ha-site-main :where(div, section, article, aside, header, footer, nav, figure, form, fieldset) {
  min-inline-size: 0;
}

:where(img, video, iframe, svg) {
  max-inline-size: 100%;
}

:where(pre, code) {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

:where(table) {
  max-inline-size: 100%;
}

:where(a[href], button, input:not([type="hidden"]), select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus {
  outline: 3px solid var(--ha-focus-colour);
  outline-offset: 3px;
}

:where(a[href], button, input:not([type="hidden"]), select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus:not(:focus-visible) {
  outline: 0;
}

:where(a[href], button, input:not([type="hidden"]), select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 3px solid #fff !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 6px var(--ha-focus-colour) !important;
}

:where(main [id], main a[href], main button, main input, main select, main textarea, main summary, main [tabindex]):focus {
  scroll-margin-top: calc(var(--ha-menu-top, 8.5rem) + 1rem);
  scroll-margin-bottom: 6rem;
}

.ha-skip-link:focus,
.ha-skip-link:focus-visible {
  top: 1rem;
  color: #000;
}

:where(button, [role="button"], input[type="button"], input[type="submit"], input[type="reset"], select) {
  min-inline-size: 24px;
  min-block-size: 24px;
}

.ha-sil-listing-page .ha-sil-compact-card h2,
.ha-sil-listing-page .ha-sil-compact-card h2.ha-sil-property-title {
  font-size: 1rem !important;
  line-height: 1.28 !important;
}

.ha-sil-listing-page .ha-sil-card-details span {
  color: var(--ha-muted);
}

.ha-form-notice:focus {
  scroll-margin-top: calc(var(--ha-menu-top, 8.5rem) + 1rem);
}

[hidden] {
  display: none !important;
}

@media (max-width: 30rem) {
  .ha-section-link,
  .ha-button,
  .ha-text-link,
  .page-numbers {
    max-inline-size: 100%;
    white-space: normal;
  }

  .ha-button,
  .ha-text-link {
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (forced-colors: active) {
  :where(a[href], button, input:not([type="hidden"]), select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible {
    outline: 3px solid CanvasText !important;
    box-shadow: none !important;
  }

  .ha-button,
  .ha-status,
  .page-numbers {
    border: 1px solid ButtonText;
  }
}
