/* ==========================================================================
   FTS: a11y.css
   Purpose: Baseline accessibility only.
   - Focus ring for public UI
   - Content link underline system (hover + keyboard focus)
   - Reduced motion
   - Beaver Builder safe zones
   ========================================================================== */

/* ========================================================================== */
/* Beaver Builder Safe Zone                                                   */
/* ========================================================================== */
/* Keep editor chrome usable and visually clean */

:where(
  .fl-builder-ui,
  .fl-builder-settings,
  .fl-builder-panel,
  .fl-builder-bar,
  .fl-lightbox,
  .fl-modal,
  .mce-container,
  .mce-window,
  .mce-widget,
  .mce-toolbar,
  .mce-btn
) {
  font-family: system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.3;
}

:where(
  .fl-builder-ui,
  .fl-builder-settings,
  .fl-builder-panel,
  .fl-builder-bar,
  .fl-lightbox,
  .fl-modal,
  .mce-container,
  .mce-window
) a {
  text-decoration: none !important;
  background-image: none !important;
  background-size: 0 0 !important;
}

/* Disable focus rings inside builder chrome */
:where(
  .fl-builder-ui,
  .fl-builder-settings,
  .fl-builder-panel,
  .fl-builder-bar,
  .fl-lightbox,
  .fl-modal,
  .mce-container,
  .mce-window
)
:where(a, button, input, textarea, select, summary, [role="button"], [tabindex]) {
  outline: none !important;
  box-shadow: none !important;
}

/* ========================================================================== */
/* Focus Ring – Public UI                                                     */
/* ========================================================================== */

:where(a, button, input, textarea, select, summary, [role="button"], [tabindex]:not([tabindex="-1"])):focus {
  outline: none;
}

:where(a, button, input, textarea, select, summary, [role="button"], [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: var(--fts-focus-width) solid var(--fts-focus-ring);
  outline-offset: var(--fts-focus-offset);
}

:where(*):focus-visible {
  scroll-margin-top: var(--fts-focus-scroll-offset);
}

@media (forced-colors: active) {
  :where(a, button, input, textarea, select, summary, [role="button"], [tabindex]:not([tabindex="-1"])):focus-visible {
    outline: 2px solid CanvasText !important;
  }
}

/* ========================================================================== */
/* Reduced Motion                                                             */
/* ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ========================================================================== */
/* Content Link Underlines                                                    */
/* ========================================================================== */
/* Hover + keyboard focus only */

:where(main, .entry-content, .fl-builder-content, .fl-rich-text, .fl-module-content)
a:not(.fl-button):not(.fts-btn):not([class*="fts-btn"]):not([role="button"]):not(.wp-block-button__link) {
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 50% calc(100% - 0.05em);
  background-size: 0% 2px;
  transition: background-size 220ms ease;
}

:where(main, .entry-content, .fl-builder-content, .fl-rich-text, .fl-module-content)
a:not(.fl-button):not(.fts-btn):not([class*="fts-btn"]):not([role="button"]):not(.wp-block-button__link):hover,
:where(main, .entry-content, .fl-builder-content, .fl-rich-text, .fl-module-content)
a:not(.fl-button):not(.fts-btn):not([class*="fts-btn"]):not([role="button"]):not(.wp-block-button__link):focus-visible {
  background-size: 100% 2px !important;
}

/* High contrast fallback */
@media (forced-colors: active) {
  :where(main, .entry-content, .fl-builder-content, .fl-rich-text, .fl-module-content)
  a:not(.fl-button):not(.fts-btn):not([class*="fts-btn"]):not([role="button"]):not(.wp-block-button__link) {
    background-image: none;
    text-decoration-line: underline !important;
  }
}

/* ========================================================================== */
/* Never Underline Controls                                                   */
/* ========================================================================== */

/* Buttons */
:where(
  a.fl-button,
  .fl-button-wrap a,
  .fl-button-group a,
  .fl-module-button a
) {
  text-decoration: none;
  background-image: none;
}

/* Accordion labels + icons */
:where(.fl-accordion-button-label, .fl-accordion-button-icon, .fl-accordion-button-icon i) {
  outline: none !important;
  text-decoration: none;
  background-image: none;
}

/* Navigation + footer */
:where(nav, footer, .fl-page-nav, .fl-page-footer-wrap, .fl-theme-builder-footer) a {
  text-decoration: none ;
  background-image: none;
}

/* Site title */
#siteTitle a {
  text-decoration: none;
  background-image: none;
}

/* ========================================================================== */
/* Builder Active on Front End                                                */
/* ========================================================================== */
/* Disable underline + focus visuals while editing */

:where(body.fl-builder, body.fl-builder-edit, body.fl-builder-preview)
:where(a, button, input, textarea, select, summary, [role="button"], [tabindex]) {
  outline: none !important;
  box-shadow: none !important;
  background-image: none !important;
  text-decoration: none !important;
}