/* ==========================================================================
   Reset & base typography
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

body {
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--ink-900);
  background: var(--surface-page);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  /* Rede de segurança contra overflow horizontal: strings longas sem
     espaços (e-mails, NIB, URLs) quebram em vez de alargar o contentor —
     a página nunca deve poder rolar na horizontal. */
  overflow-wrap: break-word;
  word-break: break-word;
}

img, svg { display: block; max-width: 100%; }
img { height: auto; }
/* <picture> só escolhe o ficheiro (AVIF/WebP/PNG) — não gera caixa própria,
   para o <img> lá dentro ficar com o mesmo layout que tinha sozinho. */
picture { display: contents; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
a { color: inherit; text-decoration: none; }

ul, ol { list-style: none; padding: 0; }

/* O atributo hidden tem de ganhar sempre — sem isto, classes como .btn ou
   .cluster (display:flex) voltavam a mostrar o elemento escondido. */
[hidden] { display: none !important; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: var(--ink-900);
}

h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-xl); }
h4 { font-size: var(--fs-md); }

p { max-width: 62ch; }

table { border-collapse: collapse; }

/* ---- Foco visível, sempre ---- */
:focus-visible {
  outline: 3px solid var(--gold-600);
  outline-offset: 3px;
  border-radius: 4px;
}
:focus:not(:focus-visible) { outline: none; }

/* ---- Utilitários de 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;
}

.skip-link {
  position: fixed;
  top: -60px;
  left: var(--space-sm);
  z-index: 200;
  background: var(--leather-900);
  color: var(--cream-100);
  padding: var(--space-xs) var(--space-md);
  border-radius: var(--radius-sm);
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus { top: var(--space-sm); }

::selection { background: var(--gold-300); color: var(--leather-900); }

/* ---- Scrollbar discreta (progressiva, não crítica) ---- */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--cream-100); }
::-webkit-scrollbar-thumb { background: var(--gold-400); border-radius: 8px; border: 3px solid var(--cream-100); }
