/* ==========================================================================
   Proposta360 — Base
   Reset moderno, tipografia e utilitários. Depende de tokens.css.
   ========================================================================== */

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

html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    /* Compensa cabeçalhos fixos ao navegar por âncora. */
    scroll-padding-top: calc(var(--topbar-height) + var(--space-4));
}

body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    /* Evita realce cinza ao tocar em elementos no Android. */
    -webkit-tap-highlight-color: transparent;
    min-height: 100dvh;
    overflow-x: hidden;
}

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(--brand);
    text-decoration: none;
    transition: color var(--duration-fast) var(--ease-out);
}

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

ul,
ol {
    list-style: none;
}

table {
    border-collapse: collapse;
    width: 100%;
}

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

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

/* --- Tipografia ---------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    font-weight: var(--weight-semibold);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tight);
    color: var(--text);
    text-wrap: balance;
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); }

p {
    text-wrap: pretty;
}

/* Calistoga entra apenas em momentos de destaque (heroes, números grandes).
   Usá-la na interface inteira prejudicaria a legibilidade em telas densas. */
.display {
    font-family: var(--font-display);
    font-weight: var(--weight-regular);
    letter-spacing: var(--tracking-tight);
    line-height: var(--leading-tight);
}

/* Rótulo mono em caixa alta — assina os dados e diferencia da interface. */
.label-mono {
    font-family: var(--font-mono);
    font-size: var(--text-2xs);
    font-weight: var(--weight-medium);
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    color: var(--text-muted);
}

.numeric {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: var(--tracking-tight);
}

.text-muted { color: var(--text-muted); }
.text-subtle { color: var(--text-subtle); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-center { text-align: center; }
.prose { max-width: var(--prose-max); line-height: var(--leading-relaxed); }

/* --- Ícones -------------------------------------------------------------- */
.icon {
    width: var(--icon-md);
    height: var(--icon-md);
    flex-shrink: 0;
    color: currentColor;
    /* Compensa a diferença entre a caixa do SVG e a baseline do texto. */
    vertical-align: -0.145em;
}

.icon-xs { width: var(--icon-xs); height: var(--icon-xs); }
.icon-sm { width: var(--icon-sm); height: var(--icon-sm); }
.icon-lg { width: var(--icon-lg); height: var(--icon-lg); }
.icon-xl { width: var(--icon-xl); height: var(--icon-xl); }

/* --- Acessibilidade ------------------------------------------------------ */
.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;
}

/* Foco visível e consistente. Nunca remover sem substituir. */
:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
    border-radius: var(--radius-xs);
}

/* Link de pulo para quem navega por teclado. */
.skip-link {
    position: absolute;
    top: calc(var(--safe-top) + var(--space-2));
    left: var(--space-2);
    z-index: var(--z-toast);
    padding: var(--space-3) var(--space-4);
    background: var(--surface);
    color: var(--text);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-weight: var(--weight-semibold);
    transform: translateY(-200%);
    transition: transform var(--duration-fast) var(--ease-out);
}

.skip-link:focus {
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* --- Utilitários de layout ------------------------------------------------ */
.stack { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

.hidden { display: none !important; }

.container {
    width: 100%;
    max-width: var(--content-max);
    margin-inline: auto;
    padding-inline: max(var(--space-5), var(--safe-left), var(--safe-right));
}

@media (min-width: 768px) {
    .container { padding-inline: var(--space-8); }
}

/* --- Entrada em cena ------------------------------------------------------ */
/* Stagger leve: entra na tela sem chamar mais atenção que o conteúdo. */
@keyframes rise-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}

@keyframes fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes scale-in {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: none; }
}

.animate-in {
    animation: rise-in var(--duration-slow) var(--ease-out) backwards;
}

.animate-in:nth-child(1) { animation-delay: 0ms; }
.animate-in:nth-child(2) { animation-delay: 45ms; }
.animate-in:nth-child(3) { animation-delay: 90ms; }
.animate-in:nth-child(4) { animation-delay: 135ms; }
.animate-in:nth-child(5) { animation-delay: 180ms; }
.animate-in:nth-child(6) { animation-delay: 225ms; }
