/* =======================================================================
   BASE — reset + elementos + utilitários
   Depende de tokens.css (carregar tokens.css ANTES deste arquivo).
   Estética Chromia: all-dark premium.
   ======================================================================= */

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

html {
  font-size: var(--font-size);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: var(--tracking-tight);
  line-height: 1.1;
}

a { color: inherit; text-decoration: none; }
img, picture, svg { max-width: 100%; display: block; }
/* lazy fade-in das imagens (só opacity; JS adiciona .is-loaded ao carregar) */
img[loading="lazy"] { opacity: 0; transition: opacity .5s var(--ease); }
img[loading="lazy"].is-loaded { opacity: 1; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
::selection { background: var(--brand-purple); color: #fff; }

/* Grão/textura editorial sutil — atmosfera de papel no lugar de "glow de IA" */
body::after { content: ''; position: fixed; inset: 0; z-index: 9999; pointer-events: none; opacity: .035; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); background-size: 160px 160px; }

/* Scrollbar (Chromia) */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: var(--background); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted-foreground); }

/* Foco acessível (teclado) */
:focus-visible { outline: 2px solid var(--ring); outline-offset: 3px; border-radius: 4px; }

/* -----------------------------------------------------------------------
   Layout helpers
   ----------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: 1140px;
  margin-inline: auto;
  padding-inline: clamp(20px, 5vw, 48px);
}

/* Eyebrow (rótulo de seção) */
.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: var(--text-xs); font-weight: 700;
  letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--brand-purple);
}
.eyebrow::before { content: ''; width: 22px; height: 1px; background: currentColor; opacity: .7; }

/* Textura de pontos (fundo sutil) */
.bg-dots {
  background-image: radial-gradient(circle, var(--dot-color) var(--dot-size), transparent var(--dot-size));
  background-size: var(--dot-space) var(--dot-space);
}

/* -----------------------------------------------------------------------
   Motion — utilitário de scroll-reveal (ativado por IntersectionObserver)
   Só anima opacity/transform. Stagger via --reveal-delay inline.
   ----------------------------------------------------------------------- */
/* Sistema de reveal direcional (inspirado no ScrollReveal do CDA-GERAL:
   duration .6s · ease cubic-bezier(.25,.1,.25,1) · offsets 32/40px) */
.reveal {
  opacity: 0;
  transform: translateY(44px);
  transition: opacity var(--dur-reveal) var(--ease-reveal), transform var(--dur-reveal) var(--ease-reveal);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}
.reveal--left  { transform: translateX(52px); }
.reveal--right { transform: translateX(-52px); }
.reveal--down  { transform: translateY(-40px); }
.reveal--scale { transform: translateY(26px) scale(.93); }
.reveal.is-visible { opacity: 1; transform: none; }

/* respiro ao navegar por âncoras (scroll-behavior smooth já está no html) */
section[id], [id].alt-block { scroll-margin-top: 28px; }

/* -----------------------------------------------------------------------
   Acessibilidade — respeitar prefers-reduced-motion (regra inviolável)
   ----------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}
