/* ==========================================================================
   Base: font, reset, typography, accessibility helpers and utilities
   ========================================================================== */
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-var-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: var(--lh);
  color: var(--text);
  background: var(--canvas);
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg, video { max-width: 100%; }
img { height: auto; }
a { color: var(--brand); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:not([class]) { text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); }
a:not([class]):hover { text-decoration-color: currentColor; }
h1, h2, h3, h4 { margin: 0; line-height: var(--lh-tight); font-weight: var(--fw-bold); letter-spacing: -.015em; color: var(--text); }
h1 { font-size: var(--fs-2xl); letter-spacing: -.025em; }
h2 { font-size: var(--fs-lg); }
h3 { font-size: var(--fs-md); }
h4 { font-size: var(--fs-sm); }
p { margin: 0 0 var(--s-3); }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0 0 var(--s-3); padding-left: 1.25rem; }
small { font-size: var(--fs-sm); }
strong, b { font-weight: var(--fw-semibold); }
code, kbd, .mono { font-family: var(--mono); font-size: .86em; }
code { background: var(--surface-2); border: 1px solid var(--line); padding: .08em .38em; border-radius: 6px; overflow-wrap: anywhere; }
pre { margin: 0 0 var(--s-3); background: var(--ink); color: #E6ECF8; border-radius: var(--r-md); padding: var(--s-4); overflow-x: auto; font-size: var(--fs-sm); line-height: 1.6; }
pre code { background: none; border: 0; padding: 0; color: inherit; overflow-wrap: normal; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--s-6) 0; }
fieldset { margin: 0; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; }
table { border-collapse: collapse; }
dialog { color: var(--text); }
::selection { background: var(--brand-soft); }

/* Focus: always visible for keyboard users */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; box-shadow: var(--focus); border-radius: 6px; }

/* Icons (shared SVG sprite) */
.icon { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 26px; height: 26px; }

/* Accessibility helpers */
.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 { position: fixed; left: var(--s-4); top: var(--s-4); z-index: 200; transform: translateY(-160%); background: var(--surface); color: var(--text); padding: var(--s-2) var(--s-4); border-radius: var(--r-sm); box-shadow: var(--shadow-3); font-weight: var(--fw-semibold); text-decoration: none; transition: transform var(--t) var(--ease); }
.skip-link:focus { transform: none; }
[hidden] { display: none !important; }

/* Text utilities */
.t-muted { color: var(--text-3); }
.t-soft { color: var(--text-2); }
.t-sm { font-size: var(--fs-sm); }
.t-xs { font-size: var(--fs-xs); }
.t-strong { font-weight: var(--fw-semibold); color: var(--text); }
.t-center { text-align: center; }
.t-num { font-variant-numeric: tabular-nums; }
.t-break { overflow-wrap: anywhere; word-break: break-word; }
.t-nowrap { white-space: nowrap; }
.t-truncate { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-success { color: var(--success); } .t-warning { color: var(--warning); } .t-danger { color: var(--danger); }

/* Spacing utilities (only the few that layouts need) */
.u-mt-2 { margin-top: var(--s-2); } .u-mt-3 { margin-top: var(--s-3); } .u-mt-4 { margin-top: var(--s-4); } .u-mt-6 { margin-top: var(--s-6); }
.u-p-0 { padding: 0 !important; } .u-mb-0 { margin-bottom: 0; } .u-mb-2 { margin-bottom: var(--s-2); } .u-mb-4 { margin-bottom: var(--s-4); } .u-mb-6 { margin-bottom: var(--s-6); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
.t-mono { font-family: var(--mono); font-size: var(--fs-sm); }
