/* ==========================================================================
   base.css — reset, tipografia e utilitários globais
   ========================================================================== */

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

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

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    font-family: var(--font);
    font-size: var(--fs-md);
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
    letter-spacing: -0.01em;
}

p { margin: 0; }

a {
    color: var(--accent-2);
    text-decoration: none;
}

a:hover { text-decoration: none; }

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

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

button { cursor: pointer; }

button:disabled { cursor: not-allowed; }

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

/* foco visível e consistente */
:focus-visible {
    outline: 2px solid var(--accent-ring);
    outline-offset: 2px;
    border-radius: var(--radius-xs);
}

/* ícones */
.ico {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    display: block;
}

.ico--sm { width: 16px; height: 16px; }
.ico--lg { width: 26px; height: 26px; }

/* barra de rolagem discreta */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-2) transparent;
}

*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: var(--border-2);
    border-radius: var(--radius-pill);
    border: 2px solid transparent;
    background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--text-3); background-clip: content-box; }

/* ============================ utilitários ============================ */

.hidden { display: none !important; }

.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;
}

.stack { display: flex; flex-direction: column; gap: clamp(14px, 1.4vw, 20px); }
.row   { display: flex; align-items: center; gap: 10px; }
.spread{ display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap  { flex-wrap: wrap; }
.grow  { flex: 1 1 auto; min-width: 0; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); }
.small { font-size: var(--fs-sm); }
.xsmall{ font-size: var(--fs-xs); }
.strong{ font-weight: 700; }
.nowrap{ white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.accent      { color: var(--accent-2); }
.accent-ok   { color: var(--ok); }
.accent-warn { color: var(--warn); }
.accent-danger { color: var(--danger); }

/* animações */
.spin { animation: sv-spin 900ms linear infinite; }

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

.pulse { animation: sv-pulse 1.8s ease-in-out infinite; }

@keyframes sv-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.45; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}
