/*
 * Base element styles. Loaded after the vendored reset + Open Props
 * primitive files and tokens.css — every value here should be a var()
 * reference into tokens.css, never a literal (see tokens.css's header
 * comment and scripts/check-design-tokens.sh).
 */

/* Defensive, general-purpose: author-origin CSS always beats the
   browser's own [hidden] { display: none } rule at equal specificity
   (origin precedence, not just specificity) — any Block below that sets
   its own `display` (`.empty-state`, `.table-wrapper`, etc.) would
   otherwise silently ignore the native `hidden` attribute/DOM property.
   Confirmed as a real bug in testing (Index's empty-state stayed visible
   after being toggled `hidden` by both server-render and dashboard.js). */
[hidden] {
  display: none !important;
}

body {
  background: var(--bg-canvas);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  font-weight: var(--font-weight-body);
  line-height: var(--leading-body);
}

h1, h2, h3, h4 {
  font-weight: var(--font-weight-bold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
}

h1 { font-size: var(--text-2xl); margin-block-end: var(--space-5); }
h2 { font-size: var(--text-xl); margin-block-end: var(--space-4); }
h3 { font-size: var(--text-lg); margin-block-end: var(--space-3); }
h4 { font-size: var(--text-md); margin-block-end: var(--space-3); }

p {
  color: var(--text-secondary);
  margin-block-end: var(--space-3);
}

a {
  color: var(--accent-text);
  text-decoration: none;
}

a:hover {
  color: var(--accent-solid-hover);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

code, pre, kbd, samp {
  font-family: var(--font-mono);
}

/* WCAG 2.4.11 Focus Appearance — every interactive element keeps a
   visible, sufficiently-offset focus ring; browser resets must never
   remove this without replacing it. */
:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
}

/* Utilities (CUBE CSS "Utility" layer) */
.text-muted {
  color: var(--text-tertiary);
}

.mono {
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}

/* Composition (CUBE CSS "Composition" layer) — small layout primitives
   reused across pages instead of one-off flex/grid rules per component. */
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
}

.grid {
  display: grid;
  gap: var(--space-4);
}

.site-main {
  padding: var(--space-5);
  max-width: 960px;
  margin: 0 auto;
}
