/* ============================================================================
 * base.css — Reset moderno + defaults tipográficos editoriais
 * Depende de tokens.css e de UM dos theme-*.css.
 * ============================================================================ */

/* ── Modern reset (Andy Bell + editorial adjustments) ───────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: var(--leading-normal);
  color: var(--text-primary);
  background-color: var(--surface-canvas);
  font-feature-settings: "ss01", "cv11";
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  font-size: var(--text-base);
  color: var(--text-primary);
  background-color: var(--surface-canvas);
  /* Belt-and-suspenders horizontal overflow guard (!156 targeted .cv-topbar;
     Painel v2 adds new chrome that occasionally pushes 1px past the viewport
     on iPhone SE 375 — main pipeline 13015). `clip` is like `hidden` but
     without creating a new scroll container; children with `position: sticky`
     keep behaving relative to the viewport. */
  overflow-x: clip;
}

img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
a { color: var(--text-link); text-decoration: none; transition: color var(--duration-fast) var(--ease-out); }
a:hover { color: var(--text-link-hover); }
ul, ol { list-style: none; }

/* ── Typography — display-first hierarchy (editorial) ───────────────────── */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text-primary);
  font-weight: var(--weight-bold);      /* Montserrat: 700 mínimo em heading pra ler forte */
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

h1 { font-size: var(--text-6xl); font-weight: var(--weight-black); letter-spacing: var(--tracking-tighter); }
h2 { font-size: var(--text-4xl); font-weight: var(--weight-black); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

/* Utilities editoriais — combinar com heading pra impact máximo */
.display-hero {
  font-family: var(--font-display);
  font-size: clamp(var(--text-6xl), 8vw, var(--text-8xl));
  line-height: 0.95;
  letter-spacing: var(--tracking-tighter);
  font-weight: var(--weight-black);
  text-wrap: balance;
  text-transform: uppercase;            /* Montserrat impact: uppercase + black + tracking negativo */
}
.display-hero em, .display-italic {
  font-style: italic;
  font-family: var(--font-display);
}

.eyebrow {
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.lede {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary);
  max-width: var(--container-prose);
  text-wrap: pretty;
}

/* Body prose (para docs/páginas de conteúdo) */
p { line-height: var(--leading-relaxed); color: var(--text-secondary); }
p + p { margin-top: 1em; }

strong, b { font-weight: var(--weight-semibold); color: var(--text-primary); }
em, i { font-style: italic; }

small { font-size: var(--text-sm); color: var(--text-tertiary); }

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

hr {
  border: 0;
  height: 1px;
  background-color: var(--border-subtle);
  margin: var(--space-8) 0;
}

/* ── Números: tabular sempre que representarem dado ─────────────────────── */
.num, .tabular {
  font-variant-numeric: tabular-nums slashed-zero;
  font-feature-settings: "tnum" 1, "zero" 1, "cv11" 1;
}

/* ── Focus ring — editorial mas acessível ───────────────────────────────── */
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--radius-sm);
}

/* ── Selection ──────────────────────────────────────────────────────────── */
::selection {
  background-color: color-mix(in oklab, var(--brand-500) 25%, transparent);
  color: var(--text-primary);
}

/* ── Scrollbar sutil ────────────────────────────────────────────────────── */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-default) transparent;
}
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-default);
  border-radius: var(--radius-full);
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--border-strong); background-clip: content-box; }

/* ── Motion respect ─────────────────────────────────────────────────────── */
@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;
  }
}
