/*
==================================================================
   · BASE
  ----------------------------------------------------------------
  Reset leve, tipografia global, comportamento de foco, scrollbars
  e utilitários de baixo nível. Aplica os tokens de theme.css.
==================================================================
*/

/*
------------------------------------------------------------------
  Reset e box model
------------------------------------------------------------------
*/
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--body-bg);
  color: var(--text-color);
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  font-weight: var(--fw-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color var(--transition), color var(--transition);
}

/*
------------------------------------------------------------------
  Tipografia
------------------------------------------------------------------
*/
h1,
h2,
h3,
h4,
h5,
h6,
.h1,
.h2,
.h3,
.h4,
.h5,
.h6 {
  color: var(--heading-color);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-tight);
  letter-spacing: -0.011em;
  margin-top: 0;
}

h1,
.h1 {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-bold);
}

h2,
.h2 {
  font-size: var(--fs-2xl);
}

h3,
.h3 {
  font-size: var(--fs-xl);
}

h4,
.h4 {
  font-size: var(--fs-lg);
}

h5,
.h5 {
  font-size: var(--fs-md);
}

h6,
.h6 {
  font-size: var(--fs-base);
}

p {
  margin-top: 0;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--primary-hover);
}

small,
.small {
  font-size: var(--fs-sm);
}

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

hr {
  border: 0;
  border-top: 1px solid var(--border-color);
  opacity: 1;
  margin: var(--space-5) 0;
}

::selection {
  background: var(--primary-soft);
  color: var(--primary);
}

/*
------------------------------------------------------------------
  Utilitários de texto (complementam o Bootstrap)
------------------------------------------------------------------
*/
.text-primary {
  color: var(--primary) !important;
}

.text-secondary {
  color: var(--text-secondary) !important;
}

.text-muted {
  color: var(--text-muted) !important;
}

.text-heading {
  color: var(--heading-color) !important;
}

.text-gradient {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.fw-medium {
  font-weight: var(--fw-medium) !important;
}

.fw-semibold {
  font-weight: var(--fw-semibold) !important;
}

.font-mono {
  font-family: var(--font-mono) !important;
}

.fs-xs {
  font-size: var(--fs-xs) !important;
}

.fs-sm {
  font-size: var(--fs-sm) !important;
}

.fs-md {
  font-size: var(--fs-md) !important;
}

.fs-lg {
  font-size: var(--fs-lg) !important;
}

.letter-tight {
  letter-spacing: -0.02em;
}

/*
------------------------------------------------------------------
  Foco acessível (WCAG) — anel de foco visível e consistente
------------------------------------------------------------------
*/
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

:focus:not(:focus-visible) {
  outline: none;
}

/* Skip link (acessibilidade por teclado) */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  z-index: var(--z-tooltip);
  padding: var(--space-2) var(--space-4);
  background: var(--primary);
  color: var(--primary-contrast);
  border-radius: 0 0 var(--radius-sm) 0;
}

.skip-link:focus {
  left: 0;
  color: var(--primary-contrast);
}

/*
------------------------------------------------------------------
  Scrollbars (webkit + firefox)
------------------------------------------------------------------
*/
* {
  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: var(--radius-pill);
  border: 2px solid transparent;
  background-clip: content-box;
}

::-webkit-scrollbar-thumb:hover {
  background-clip: padding-box;
}

/*
------------------------------------------------------------------
  Superfícies utilitárias reutilizáveis
------------------------------------------------------------------
*/
.surface {
  background: var(--surface);
}

.surface-2 {
  background: var(--surface-2);
}

.bg-body {
  background: var(--body-bg) !important;
}

.border-app {
  border: 1px solid var(--border-color) !important;
}

.border-app-strong {
  border: 1px solid var(--border-strong) !important;
}

.rounded-app {
  border-radius: var(--radius) !important;
}

.rounded-app-lg {
  border-radius: var(--radius-lg) !important;
}

.shadow-app {
  box-shadow: var(--shadow) !important;
}

.shadow-app-sm {
  box-shadow: var(--shadow-sm) !important;
}

.shadow-app-lg {
  box-shadow: var(--shadow-lg) !important;
}

/* Vidro / glassmorphism (usar com moderação) */
.glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur));
  backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
}

/*
------------------------------------------------------------------
  Preferência de movimento reduzido (acessibilidade)
------------------------------------------------------------------
*/
@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}