/* ============================================================
   BASE — reset, tipografia, utilitários, acessibilidade
   Mobile-first: todos os valores base são para ecrã pequeno;
   overrides de desktop entram por min-width (Regra Permanente 8).
   ============================================================ */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: var(--font-body);
  color: var(--color-ink);
  background: var(--color-paper);
  line-height: var(--lh-body);
  overflow-x: hidden;
  transition: background .4s ease, color .4s ease;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--color-navy);
  font-weight: 500;
  line-height: var(--lh-heading);
  letter-spacing: -0.015em;
}
html.dark h1, html.dark h2, html.dark h3 { color: #F2F2FA; }

h1 { font-size: var(--fs-display); }
h2 { font-size: var(--fs-h2); }
h3 { font-family: var(--font-body); font-size: var(--fs-h3); font-weight: 600; }

p { font-size: var(--fs-body); }

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--container-pad);
}
@media (min-width: 600px) { .container { --container-pad: 24px; } }
@media (min-width: 1024px) { .container { --container-pad: 64px; } }

a { text-decoration: none; color: inherit; }
img, svg { max-width: 100%; display: block; }
button { font-family: inherit; }

::selection { background: var(--color-gold); color: var(--color-navy); }

section { padding: var(--section-pad-mobile) 0; }
@media (min-width: 768px) { section { padding: var(--section-pad-desktop) 0; } }

/* ---- Acessibilidade: skip-link, foco visível (Parte E.1) ---- */
.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  background: var(--color-navy);
  color: #fff;
  padding: 12px 20px;
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: 14px;
  z-index: 2100;
  transition: top .2s var(--ease-premium);
}
.skip-link:focus {
  top: 12px;
  outline: 2px solid var(--color-gold);
  outline-offset: 2px;
}

:focus-visible {
  outline: 2px solid var(--color-gold);
  outline-offset: 3px;
  border-radius: 2px;
}
/* nunca remover outline sem alternativa (E.1) — apenas suprimido quando
   o próprio componente define um estado de foco equivalente (ver components.css) */

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ---- Textura de grão — puramente decorativa, aria-hidden no HTML ---- */
#grain {
  position: fixed; inset: 0; z-index: var(--z-grain); pointer-events: none;
  opacity: .035; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px;
}
@media (prefers-reduced-motion: reduce) { #grain { opacity: .02; } }

#progress {
  position: fixed; top: 0; left: 0; height: 3px; background: var(--color-gold);
  width: 0%; z-index: var(--z-progress); transition: width .1s linear;
}

#preloader {
  position: fixed; inset: 0; z-index: var(--z-preloader);
  background: var(--color-navy);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .7s ease, visibility .7s ease;
}
#preloader path { stroke-dasharray: 420; stroke-dashoffset: 420; animation: sup-draw 1.1s cubic-bezier(.65,0,.35,1) forwards; }
#preloader path:nth-child(2) { animation-delay: .12s; }
#preloader.hide { opacity: 0; visibility: hidden; }
@keyframes sup-draw { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) {
  #preloader path { animation-duration: .01s; }
}
