/*
 * Kit base: accessibility rules only, no look.
 * Every selector is wrapped in :where() so it has zero specificity: any rule in your own
 * stylesheet wins without !important. Colours come from custom properties you may set:
 *   --kit-focus            focus ring colour (needs 3:1 against what it sits on)
 *   --kit-error            error text and invalid field border
 *   --kit-consent-bg / --kit-consent-fg / --kit-consent-border   cookie banner colours
 * The kit does not set fonts, sizes, spacing, layout, header, footer, nav or button visuals.
 */

/* hidden always hides, even if a site sets display on the element */
[hidden] { display: none !important; }

:where(html) { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
:where(img, svg, video, canvas, picture) { max-width: 100%; height: auto; }

/* Visible keyboard focus everywhere. Restyle it if you like, never remove it. */
:where(:focus-visible) {
  outline: 3px solid var(--kit-focus, #1a1a1a);
  outline-offset: 2px;
}
:where(main:focus) { outline: none; }

/* Screen-reader-only text */
:where(.kit-sr-only, .sr-only) {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Skip link: off screen until focused, then visible at the top left */
:where(.kit-skip-link) {
  position: absolute; left: 8px; top: -100px; z-index: 2147483600;
  padding: 12px 16px; min-height: 44px; box-sizing: border-box;
  background: var(--kit-skip-bg, #fff); color: var(--kit-skip-fg, #1a1a1a);
  border: 2px solid currentColor; text-decoration: underline;
}
:where(.kit-skip-link:focus, .kit-skip-link:focus-visible) { top: 8px; }

/* 44 px minimum targets for controls (zero specificity: override per element if you must) */
:where(button, select, summary, input:not([type="checkbox"], [type="radio"], [type="hidden"]), .kit-target) {
  min-height: 44px;
}
:where(summary) { cursor: pointer; }

/* Reduced motion: honour the visitor's setting */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important; scroll-behavior: auto !important;
  }
}

/* Forms: state hooks only. Labels sit above fields because the markup puts them first. */
:where(.kit-field) { display: flex; flex-direction: column; align-items: flex-start; }
:where(.kit-field > label) { display: block; }
:where(.kit-field__error) { color: var(--kit-error, #b00020); margin: 4px 0 0; }
:where([aria-invalid="true"]) { border-color: var(--kit-error, #b00020); }
:where(.kit-error-summary) { border: 2px solid var(--kit-error, #b00020); padding: 12px 16px; margin: 0 0 16px; }
:where(.kit-error-summary a) { color: inherit; }
:where(.kit-form-status:empty) { display: none; }

/* Form honeypot (_gotcha): off screen, not display:none, so bots still fill it; aria-hidden and tabindex -1 in the markup */
.kit-hp { position: absolute !important; left: -10000px !important; top: auto !important; width: 1px !important; height: 1px !important; overflow: hidden !important; }

/* Cookie banner: neutral, readable, both buttons share one class so they always look the same.
   Restyle .kit-consent and .kit-consent__btn in your own CSS; QA checks the two buttons stay identical. */
:where(.kit-consent) {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 2147483000;
  background: var(--kit-consent-bg, #fff); color: var(--kit-consent-fg, #1a1a1a);
  border-top: 2px solid var(--kit-consent-border, #1a1a1a);
  padding: 16px; box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.2);
}
:where(.kit-consent__inner) {
  max-width: 960px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 12px;
  align-items: center; justify-content: space-between;
}
:where(.kit-consent__title) { margin: 0; flex: 1 1 100%; }
:where(.kit-consent__text) { flex: 1 1 320px; }
:where(.kit-consent__text p) { margin: 0 0 8px; }
:where(.kit-consent__text p:last-child) { margin-bottom: 0; }
:where(.kit-consent__text a) { color: inherit; }
:where(.kit-consent__actions) { display: flex; gap: 12px; flex-wrap: wrap; }
:where(.kit-consent__btn) {
  font: inherit; font-weight: 700; min-width: 120px; min-height: 44px; padding: 8px 20px;
  border: 2px solid currentColor; border-radius: 4px;
  background: var(--kit-consent-bg, #fff); color: var(--kit-consent-fg, #1a1a1a); cursor: pointer;
}
:where(html.kit-consent-open body) { padding-bottom: var(--kit-consent-height, 0px); }
/* The banner is a modal: the page behind is inert, so a light scrim shows it cannot be used until a choice */
:where(html.kit-consent-open body)::after {
  content: ""; position: fixed; inset: 0; z-index: 2147482999; pointer-events: none;
  background: var(--kit-consent-scrim, rgba(16, 20, 24, 0.32));
}
:where(.kit-consent:focus) { outline: none; }
:where(.kit-consent__mode) { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; width: 100%; }
