/**
 * Global resets — box-sizing, scrollbar hiding, focus management,
 * universal normalize, and the size-query provider utility.
 *
 * Imported via styles/index.css (the barrel) and linked directly by most
 * surfaces. Targets document-level defaults and universal selectors;
 * component-scoped rules live in each component's own CSS under
 * `@scope (component-ui)`. Element-level *typographic* defaults live in
 * styles/type/elements.css (v0.6.48 reorg, ADR-0035), not here.
 */

*,
*::before,
*::after {
  box-sizing: border-box;
  scrollbar-width: none;
}

*::-webkit-scrollbar {
  display: none;
}

/* Kill default focus outline — components manage their own via --a-focus-ring */
*:focus {
  outline: none;
}

/* Prevent text selection on all interactive components */
:is(button-ui, kbd-ui, tag-ui, input-ui, textarea-ui, select-ui, check-ui, radio-ui, switch-ui,
    slider-ui, range-ui, segmented-ui, segment-ui) {
  user-select: none;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  hanging-punctuation: first last;
  color-scheme: light dark;
}

/* Smooth in-page anchor navigation for `<link-ui href="#section">`,
   table-of-contents jumps, and any `scrollIntoView()` call. Gated by
   `prefers-reduced-motion: no-preference` so the OS-level motion
   preference still wins for users who opt out. */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;

  margin: 0;
  font-family: var(--a-font-family);
  font-size: var(--a-body-size);
  font-style: normal;
  font-variation-settings: 'slnt' 0, 'ital' 0;
  line-height: 1.5;
  color: var(--a-fg);
  background: var(--a-bg);
  min-block-size: 100dvb;
}

img,
picture,
svg,
video,
canvas {
  display: block;
  max-inline-size: 100%;
  block-size: auto;
}

/* The `ul/ol[role="list"]` semantic-list opt-out moved to
   styles/type/elements.css (with the other element list defaults) during the
   @layer migration — it's an element-default refinement that must win by
   specificity, not a floor-reset that may be demoted to the `reset` layer.
   See ADR-0038 step 2 + the cascade-reset-layer probe. */

/* ── Size-query provider utility ──────────────────────────────────
   Opt any element into being a container-query size provider for
   its descendants, without the nesting fragility of applying
   container-type to every instance of a primitive. Use sparingly —
   on panels, split-panes, cards that actually need responsive
   children — and descendants query via bare `@container (width < Xrem)`
   (matches nearest) or `@container container (...)` for clarity.

   Why inline-size: block-direction height stays content-driven.
   Why an attribute: explicit opt-in; avoids accidental containment
   collapse when a primitive is composed inside another flex chain. */
[provide-container-inline-size] {
  container-type: inline-size;
  container-name: container;
}


/* Global focus fallback for focusable elements WITHOUT their own @scope
   focus styling (plain <a>, [tabindex], etc.). Components override via
   --a-focus-ring. `Highlight` (system color) is deliberate — it respects the
   OS/user focus color and forced-colors mode. Fixed v0.6.48 (ADR-0035): the
   width hook used the dead --ui-* namespace; --a-focus-width (2px) is the live
   token, so the computed value is unchanged (2px solid Highlight). */
:focus-visible {
  outline: var(--a-focus-width, 2px) solid Highlight;
  outline-offset: var(--a-focus-offset, 2px);
}

::selection {
  background: var(--a-selection-bg);
  color: var(--a-selection-text);
  border-radius: var(--a-selection-radius);
}

/* Native element typography (h1-h6 balance/leading, p/li/figcaption
   text-wrap, a underline-offset) now lives in styles/type/elements.css —
   one home for element-level typographic defaults (v0.6.48 reorg, ADR-0035). */
