/* ==========================================================================
   BASE: reset, tipografia, utilitários, acessibilidade
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-gutter: stable;
  background: var(--paper);
  transition: background-color var(--t-palette) var(--ease-io);
}
html.is-switching { overflow: hidden; }       /* trava o scroll durante o fade */

body {
  margin: 0;
  font-family: var(--font-text);
  font-size: var(--fs-body);
  font-weight: 400;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  transition: background-color var(--t-palette) var(--ease-io), color var(--t-palette) var(--ease-io);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}

img, picture, svg, video { display: block; max-width: 100%; }
img { height: auto; }
figure, blockquote { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, p, dl, dd { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }

h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

/* ---- Tipografia ---------------------------------------------------------- */
.h2 {
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -.018em;
  font-optical-sizing: auto;
}
.h3 {
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -.005em;
}
.lead {
  font-size: var(--fs-lead);
  line-height: 1.5;
  font-weight: 300;
  max-width: 38rem;
}
.prose { max-width: 38rem; }
.prose > * + * { margin-top: var(--sp-4); }
.muted { color: var(--ink-soft); }

/* Ligação de texto com sublinhado que se desenha */
.link {
  text-decoration: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 100% 1px no-repeat;
  padding-bottom: .12em;
  transition: background-size .35s var(--ease-out);
}
.link:hover { background-size: 0 1px; background-position: 100% 100%; }

/* ---- Layout -------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.section { padding-block: var(--section-y); }
.section--tint { background: var(--paper-2); }
.section--field { background: var(--field); color: var(--white); }
.section--deep { background: var(--deep); color: var(--white); }
[data-section] { scroll-margin-top: var(--hd-clear); }

/* ---- Acessibilidade ------------------------------------------------------ */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}
.section--field :focus-visible,
.section--deep :focus-visible,
.on-field :focus-visible { outline-color: var(--white); }

.skip-link {
  position: fixed;
  top: .75rem; left: .75rem;
  z-index: 200;
  padding: .75rem 1.25rem;
  background: var(--deep);
  color: var(--white);
  border-radius: var(--r-pill);
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform .25s var(--ease-out);
}
.skip-link:focus { transform: none; }

/* ---- Estado antes do JS estar pronto ------------------------------------ */
/* sem transições nos primeiros frames: o site abre já na paleta certa */
html.preload *, html.preload *::before, html.preload *::after { transition: none !important; }

/* ---- Movimento reduzido -------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  :root { --t-palette: .01ms; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  .link, .btn { transition-duration: .01ms !important; }
}
