/* ─────────────────────────────────────────────────────────────────────────
   Vetrda — base: reset, tipografia, layout primitivo
   ───────────────────────────────────────────────────────────────────────── */

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--t-base);
  line-height: var(--lh-base);
  color: var(--c-text);
  background: var(--c-bg);
  /* Em iOS o overscroll elástico num app instalado parece um bug. */
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Números de estatística alinhados: sem "salto" quando o valor muda. */
.tnum { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum' 1; }

h1, h2, h3, h4, p, figure { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

h1 { font-size: var(--t-xl);   font-weight: var(--fw-bold);   line-height: var(--lh-tight); letter-spacing: -0.02em; }
h2 { font-size: var(--t-lg);   font-weight: var(--fw-semi);   line-height: var(--lh-snug);  letter-spacing: -0.01em; }
h3 { font-size: var(--t-md);   font-weight: var(--fw-semi);   line-height: var(--lh-snug); }
h4 { font-size: var(--t-base); font-weight: var(--fw-semi);   line-height: var(--lh-snug); }

a { color: var(--c-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

button, input, select, textarea {
  font: inherit;
  color: inherit;
  margin: 0;
}
button { cursor: pointer; background: none; border: 0; padding: 0; }

/* Imagens e ícones */
img, svg { display: block; max-width: 100%; }
svg { fill: currentColor; }

/* ── Foco visível ───────────────────────────────────────────────────────
   Nunca remover o anel de foco sem substituto: é a única forma de quem
   navega por teclado saber onde está. */
:focus-visible {
  outline: 3px solid var(--c-primary);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
:focus:not(:focus-visible) { outline: none; }

/* ── Saltar para o conteúdo ────────────────────────────────────────────  */
.skip-link {
  position: absolute;
  left: -9999px;
  top: var(--s-2);
  z-index: 999;
  padding: var(--s-3) var(--s-4);
  background: var(--c-primary);
  color: var(--c-primary-contrast);
  border-radius: var(--r-md);
  font-weight: var(--fw-semi);
}
.skip-link:focus { left: var(--s-4); }

/* ── Ecrã ───────────────────────────────────────────────────────────────  */
.app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  min-height: var(--header-h);
  padding: var(--s-3) var(--s-4);
  padding-top: calc(var(--s-3) + var(--safe-t));
  display: flex;
  align-items: center;
  gap: var(--s-3);
  background: color-mix(in srgb, var(--c-bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--d-base) var(--ease);
}
.app-header[data-scrolled='true'] { border-bottom-color: var(--c-border); }

.app-header__title {
  font-size: var(--t-md);
  font-weight: var(--fw-semi);
  letter-spacing: -0.01em;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-header__sub {
  display: block;
  font-size: var(--t-xs);
  font-weight: var(--fw-normal);
  color: var(--c-text-3);
  letter-spacing: 0;
}

.app-main {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--s-4) var(--s-4) calc(var(--nav-h) + var(--safe-b) + var(--s-6));
}
@media (min-width: 900px) {
  .app-main { padding-bottom: var(--s-8); }
}

/* ── Utilitários de layout ────────────────────────────────────────────── */
.stack   { display: flex; flex-direction: column; gap: var(--s-4); }
.stack-2 { display: flex; flex-direction: column; gap: var(--s-2); }
.stack-3 { display: flex; flex-direction: column; gap: var(--s-3); }
.row     { display: flex; align-items: center; gap: var(--s-3); }
.row-2   { display: flex; align-items: center; gap: var(--s-2); }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.wrap    { flex-wrap: wrap; }
.grow    { flex: 1; min-width: 0; }
.center  { text-align: center; }
.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;
}

/* ── Texto ────────────────────────────────────────────────────────────── */
.t-xs   { font-size: var(--t-xs); }
.t-sm   { font-size: var(--t-sm); }
.t-md   { font-size: var(--t-md); }
.t-lg   { font-size: var(--t-lg); }
.dim    { color: var(--c-text-2); }
.dim-2  { color: var(--c-text-3); }
.strong { font-weight: var(--fw-semi); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.eyebrow {
  font-size: var(--t-xs);
  font-weight: var(--fw-semi);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--c-text-3);
}

/* ── Acessibilidade: reduzir movimento ────────────────────────────────
   Quem pediu menos movimento no sistema não deve levar com transições. */
@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;
  }
}

/* ── Impressão: a escala de campo tem de sair em papel ────────────────── */
@media print {
  .app-header, .app-nav, .no-print { display: none !important; }
  .app-main { padding: 0; max-width: none; }
  body { background: #fff; color: #000; }
}
