/* ============================================================================
   FOCUS — RESET + BASE
============================================================================ */

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

* {
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga", "calt", "ss01";
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  transition: background var(--dur-slow) var(--ease), color var(--dur-slow) var(--ease);
}

/* ── Grão sutil no fundo (textura de papel / noise elegante) ─────────── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
}

[data-theme="dark"] body::before,
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body::before { mix-blend-mode: screen; }
}

img, svg, video, canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 500;
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-snug);
}

/* ── Classes tipográficas ────────────────────────────────────────────── */
.font-display { font-family: var(--font-display); font-optical-sizing: auto; }
.font-body    { font-family: var(--font-body); }
.font-mono    { font-family: var(--font-mono); font-feature-settings: "tnum" 1; }

.tabular { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

/* ── Scrollbar refinada ──────────────────────────────────────────────── */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--text-faint) transparent;
}
*::-webkit-scrollbar        { width: 10px; height: 10px; }
*::-webkit-scrollbar-track  { background: transparent; }
*::-webkit-scrollbar-thumb  {
  background: var(--text-faint);
  border: 3px solid var(--bg);
  border-radius: var(--radius-full);
}
*::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Selection ───────────────────────────────────────────────────────── */
::selection {
  background: var(--accent);
  color: var(--accent-contrast);
}

/* ── Focus ring refinado (keyboard only) ─────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}

/* ── Helpers ─────────────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.hidden { display: none !important; }
