/* ═══════════════════════════════════════════════════════════════════════════
   AxiAPIS UI v5 "ATLAS" — base.css
   Reset moderno, elementos, tipografia, utilitários, scrollbar, seleção,
   foco acessível e reduced-motion.
   ═══════════════════════════════════════════════════════════════════════════ */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 84px;
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-md);
  line-height: 1.6;
  color: var(--text-1);
  background: var(--bg-0);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
}

img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

/* ── Tipografia ──────────────────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--font-display);
  color: var(--text-0);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.022em;
}
h1 { font-size: var(--fs-2xl); letter-spacing: -0.03em; }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); }
h4 { font-size: var(--fs-base); }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--dur) var(--ease-out);
}
a:hover { color: var(--accent-strong); }

code, kbd, pre, samp {
  font-family: var(--font-mono);
  font-size: 0.86em;
}
code {
  background: var(--bg-3);
  border: 1px solid var(--border-0);
  border-radius: var(--r-xs);
  padding: 0.1em 0.4em;
  color: var(--text-1);
}
pre { line-height: 1.62; }
kbd {
  display: inline-block;
  background: var(--kbd-bg);
  border: 1px solid var(--border-1);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  font-size: var(--fs-2xs);
  color: var(--text-2);
  line-height: 1.5;
}

hr {
  border: 0;
  border-top: 1px solid var(--border-0);
  margin: var(--sp-6) 0;
}

::selection { background: var(--selection-bg); }

/* ── Foco visível (teclado) ──────────────────────────────────────────────── */
:focus { outline: none; }
:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
  border-radius: var(--r-xs);
}

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

/* ── Utilitários ─────────────────────────────────────────────────────────── */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.mb-3 { margin-bottom: var(--sp-3); }
.mt-2 { margin-top: var(--sp-2); }
.text-secondary { color: var(--text-2); }
.mono { font-family: var(--font-mono); }
.hide { display: none !important; }

/* label mono de seção — assinatura do sistema */
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.eyebrow b, .eyebrow strong { color: var(--accent); font-weight: 600; }

.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  flex: none;
  display: inline-block;
}
.pulse-dot { position: relative; }
.pulse-dot::after {
  content: "";
  position: absolute; inset: -3px;
  border-radius: 50%;
  border: 1px solid var(--success);
  opacity: 0.5;
  animation: ax-pulse 2.2s var(--ease-soft) infinite;
}
@keyframes ax-pulse {
  0% { transform: scale(0.6); opacity: 0.6; }
  70% { transform: scale(1.25); opacity: 0; }
  100% { transform: scale(1.25); opacity: 0; }
}

.animate-fade-in { animation: ax-fade-in 0.32s var(--ease-out) both; }
@keyframes ax-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

@keyframes ax-spin { to { transform: rotate(360deg); } }

/* skeleton loading */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--bg-3);
  border-radius: var(--r-xs);
  min-height: 14px;
}
.skeleton::after {
  content: "";
  position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  animation: ax-shimmer 1.4s infinite;
}
html[data-theme="dark"] .skeleton::after {
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
}
@keyframes ax-shimmer { to { transform: translateX(100%); } }

/* estado vazio */
.empty {
  padding: var(--sp-10) var(--sp-6);
  text-align: center;
  color: var(--text-3);
  font-size: var(--fs-md);
  border: 1px dashed var(--border-1);
  border-radius: var(--r-md);
  background: var(--bg-2);
}

/* ── Movimento reduzido ──────────────────────────────────────────────────── */
@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;
  }
}
