/* ==========================================================================
   Connecfy — base: reset, typography, accessibility primitives
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-sans);
  font-size: var(--fs-400);
  line-height: var(--lh-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 700;
  line-height: var(--lh-snug);
  letter-spacing: -0.012em;
  color: var(--text);
  text-wrap: balance;
}
p { margin: 0; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; }
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button, input, select, textarea { font: inherit; color: inherit; }
table { border-collapse: collapse; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--sp-8) 0; }

a {
  color: var(--accent-text);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-thickness: 2px; }

code, kbd, samp, pre { font-family: var(--font-mono); font-size: 0.92em; }
:not(pre) > code {
  padding: 0.1em 0.38em;
  background: var(--slate-100);
  border: 1px solid var(--slate-150);
  border-radius: var(--r-1);
  font-size: 0.86em;
  overflow-wrap: anywhere;
}
kbd {
  padding: 0.1em 0.45em;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: var(--r-1);
  background: var(--surface);
  font-size: 0.8em;
}

::selection { background: var(--signal-200); color: var(--slate-950); }

/* Focus: always visible, never colour-only */
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--r-1);
}

[hidden] { display: none !important; }

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -4rem;
  z-index: var(--z-toast);
  padding: var(--sp-2) var(--sp-4);
  background: var(--slate-900);
  color: var(--white);
  font-weight: 600;
  border-radius: var(--r-2);
  text-decoration: none;
  transition: top var(--dur-1) var(--ease);
}
.skip-link:focus { top: var(--sp-3); }

.mono { font-family: var(--font-mono); }
.num  { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-muted); }
.nowrap { white-space: nowrap; }

/* Layout primitives: vertical rhythm and wrapping rows, tuned per use */
.stack   { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--stack-gap, var(--sp-6)); align-content: start; }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--cluster-gap, var(--sp-3)); }
.spread  { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--sp-3) var(--sp-6); }

@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;
  }
}
