/* Pointer and touch interactions must not retain the browser's blue focus ring. */
body :is(a, button, [role="button"], summary, [tabindex]):focus:not(:focus-visible) {
  outline: none !important;
}

body :is(a, button, [role="button"], summary, [tabindex]) {
  -webkit-tap-highlight-color: transparent;
}

/* Keyboard navigation keeps a visible focus ring in the brand colour. */
body :is(a, button, [role="button"], summary, [tabindex]):focus-visible {
  outline: 2px solid var(--sc-color-focus, #b28f76) !important;
  outline-offset: 3px;
}

/* A box shadow follows each field's existing border radius, including on mobile. */
body :is(
  input:not([type="hidden"], [type="checkbox"], [type="radio"], [type="range"], [type="color"], [type="file"], [type="button"], [type="submit"], [type="reset"], [type="image"]),
  textarea,
  select
):focus {
  outline: 2px solid transparent !important;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px var(--sc-color-ink, #6a4b3b) !important;
}

/* Composite fields draw the focus ring on their visible outer frame. */
body #scchatbot .scchatbot-form:focus-within {
  box-shadow: 0 0 0 2px var(--chat-ink, #6a4b3b);
}

body #scchatbot .scchatbot-form textarea:focus,
body #footer .sc-newsletter__input:focus,
body input.sc-search-overlay__input:focus {
  outline: none !important;
  box-shadow: none !important;
}

body .sc-search-overlay__form:focus-within {
  border-bottom-color: var(--sc-color-ink, #6a4b3b);
  box-shadow: 0 2px 0 var(--sc-color-ink, #6a4b3b);
}

/* System outlines remain visible when high-contrast mode suppresses shadows. */
@media (forced-colors: active) {
  body :is(a, button, [role="button"], summary, [tabindex]):focus-visible,
  body :is(input, textarea, select):focus,
  body #scchatbot .scchatbot-form:focus-within,
  body #footer .sc-newsletter__field:focus-within,
  body .sc-search-overlay__form:focus-within {
    outline: 2px solid Highlight !important;
    outline-offset: 2px;
  }

  body #scchatbot .scchatbot-form textarea:focus,
  body #footer .sc-newsletter__input:focus,
  body input.sc-search-overlay__input:focus {
    outline: none !important;
  }
}
