/* Reset and base element styles. Depends on tokens.css and a theme
   file being loaded first. */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-family-base);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-base);
  background: var(--color-bg);
  color: var(--color-text-primary);
  transition: background var(--duration-base) var(--ease-standard),
    color var(--duration-base) var(--ease-standard);
}

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  /* Phase E Milestone 19: user-detail.js/worker-detail.js interpolate a
     raw, untrusted username/workername (docs/ARCHITECTURE.md Section
     18: free text, no charset restriction, can be arbitrarily long
     with no whitespace) directly into a heading. Without this, a long
     unbroken address can't wrap and overflows the viewport at narrow
     widths. `anywhere` (not break-all) only breaks a word when it
     would otherwise overflow, and unlike `break-word` it also counts
     toward the box's min-content size, so a heading correctly
     contributes a small minimum width to any ancestor sizing
     calculation instead of an unbreakable one. */
  overflow-wrap: anywhere;
}

a {
  color: var(--color-accent-text);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

img, svg {
  display: block;
  max-width: 100%;
}

table {
  border-collapse: collapse;
}

/* docs/DESIGN_SYSTEM.md Section 8: icon sizing. Phase F closed the icon
   gap disclosed since Milestone 5 -- components/icons.js now supplies a
   real inline-SVG child (fill: none, stroke: currentColor) for every
   icon name with a real call site, per Section 8's "inline SVG icons"
   approach. `.icon:empty` is kept: `icon-hamburger` still renders via
   its own hand-drawn ::before glyph (shell.css) rather than an SVG
   child, and any icon name icons.js does not (yet) cover still falls
   back to this same empty/hidden behaviour rather than a blank box.
   Each component's own icon class may override width/height where the
   design system calls for a non-default size (e.g. empty-state's
   --icon-size-lg); this rule only supplies the default. */
.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--icon-size-md);
  height: var(--icon-size-md);
  flex-shrink: 0;
}

.icon:empty {
  display: none;
}

.icon svg {
  width: 100%;
  height: 100%;
}

/* Numeric values that should align in columns -- docs/DESIGN_SYSTEM.md
   Section 5: ordinary numeric stats use the base font with
   tabular-nums, not a separate monospace typeface. */
.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Values where character ambiguity matters (usernames, workernames,
   hashes) -- docs/DESIGN_SYSTEM.md Section 5. Phase G.3: this is the
   same token every numeric DATA value now uses too
   (docs/DESIGN_SYSTEM_V2.md Section 3) -- renamed --font-family-mono
   -> --font-family-data to reflect that broader role. */
.mono {
  font-family: var(--font-family-data);
}

/* Visible focus ring, applied consistently rather than per-component
   -- docs/ARCHITECTURE.md Section 17, docs/DESIGN_SYSTEM.md Section
   10.1: never remove focus-visible styling, only restyle it.
   --color-accent-text, not the bare --color-accent fill value: Phase F
   verified (docs/DESIGN_SYSTEM.md Section 13) that the bare fill value
   fails the 3:1 non-text contrast threshold on light theme (1.32:1
   against --color-bg, 1.40:1 against --color-surface) -- a focus ring
   that's effectively invisible on light theme. --color-accent-text
   already clears the stricter 4.5:1 text threshold on light theme, so
   it clears 3:1 too, and it's identical to the bare value on dark
   theme (theme-dark.css), so this produces no visual change there. */
:focus-visible {
  outline: 2px solid var(--color-accent-text);
  outline-offset: 2px;
}

/* Skip-to-content link -- docs/ARCHITECTURE.md Section 17. Hidden
   until focused, so it doesn't appear for mouse/touch users. */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-surface);
  color: var(--color-text-primary);
  padding: var(--space-2) var(--space-4);
  z-index: 100;
  border: var(--border-width) solid var(--border-color);
  border-radius: var(--radius-sm);
}

.skip-link:focus {
  top: var(--space-2);
  left: var(--space-2);
}

/* Visually hidden but still available to assistive technology --
   used for chart accessible summaries (docs/ARCHITECTURE.md Section
   17, docs/DESIGN_SYSTEM.md Section 10.6). */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
