/* ─── 1. Reset ─────────────────────────────────── */

/* 1. Use a more-intuitive box-sizing model */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* 2. Remove default margin */
*:not(dialog) {
  margin: 0;
}

/* 3. Enable keyword animations */
@media (prefers-reduced-motion: no-preference) {
  html {
    interpolate-size: allow-keywords;
  }
}

body {
  /* 4. Increase line-height */
  line-height: 1.5;
  /* 5. Improve text rendering */
  -webkit-font-smoothing: antialiased;
}

/* 6. Improve media defaults */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

/* 7. Inherit fonts for form controls */
input,
button,
textarea,
select {
  font: inherit;
}

/* 8. Avoid text overflows */
p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

/* 9. Improve line wrapping */
p {
  text-wrap: pretty;
}
h1,
h2,
h3,
h4,
h5,
h6 {
  text-wrap: balance;
}

/*
  10. Create a root stacking context
*/
#root,
#__next {
  isolation: isolate;
}

/* ─── 2. Variáveis ──────────────────────────────── */
:root {
  --cor-primaria: #3b82f6;
  --cor-fundo: #ffffff;
  --cor-fundo-alt: #f3f4f6;
  --cor-texto: #1f2937;
  --cor-branca: #ffffff;
  --altura-nav: 60px;
  --espaco-md: 1rem;
  --espaco-lg: 2rem;
  --raio-borda: 8px;
  --raio-circulo: 9999px;
  --z-nav: 1000;
  --z-sticky: 100;
  --z-btn-topo: 999;
  --z-tooltip: 500;
}

/* ─── 3. Base ───────────────────────────────────── */
body {
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--cor-texto);
  background-color: var(--cor-fundo);
}

/* ─── 4. Layout ─────────────────────────────────── */
main {
  padding-top: var(--altura-nav);
  max-width: 800px;
  margin: 0 auto;
  padding-inline: var(--espaco-md);
}

section {
  margin-bottom: 4rem;
}

/* ─── 5. Componentes ────────────────────────────── */

/* Componente 1 — Barra de navegação fixa */
.nav-fixa {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: var(--altura-nav);
  background-color: var(--cor-primaria);
  color: var(--cor-branca);
  z-index: var(--z-nav);
  display: flex;
  align-items: center;
  padding: 0 var(--espaco-lg);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.nav-fixa ul {
  display: flex;
  list-style: none;
  gap: var(--espaco-md);
}

.nav-fixa a {
  color: inherit;
  text-decoration: none;
  font-weight: bold;
}

/* Componente 2 — Cabeçalho de seção grudento */
.titulo-sticky {
  position: sticky;
  top: var(--altura-nav);
  z-index: var(--z-sticky);
  background-color: var(--cor-fundo);
  padding: var(--espaco-md) 0;
  border-bottom: 2px solid var(--cor-primaria);
  margin-top: var(--espaco-lg);
}

/* Componente 3 — Selo de destaque */
.cartao-destaque {
  position: relative;
  background-color: var(--cor-fundo-alt);
  padding: var(--espaco-lg);
  border-radius: var(--raio-borda);
  border: 1px solid #ddd;
  margin: var(--espaco-lg) 0;
}

.selo {
  position: absolute;
  top: -10px;
  right: -10px;
  background-color: var(--cor-primaria);
  color: var(--cor-branca);
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: bold;
  border-radius: var(--raio-circulo);
  box-shadow: 2px 2px 5px rgba(0,0,0,0.2);
}

/* Componente 4 — Botão "Voltar ao topo" */
.btn-topo {
  position: fixed;
  bottom: var(--espaco-lg);
  right: var(--espaco-lg);
  z-index: var(--z-btn-topo);
  width: 50px;
  height: 50px;
  background-color: var(--cor-primaria);
  color: var(--cor-branca);
  border-radius: var(--raio-circulo);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 1.5rem;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: opacity 0.3s;
}

.btn-topo:hover {
  opacity: 0.8;
}

/* Componente 5 — Tooltip */
.tooltip-container {
  position: relative;
  display: inline-block;
  cursor: help;
  color: var(--cor-primaria);
  text-decoration: underline dotted;
}

.tooltip-texto {
  visibility: hidden;
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background-color: #333;
  color: #fff;
  padding: 0.5rem;
  border-radius: var(--raio-borda);
  white-space: nowrap;
  z-index: var(--z-tooltip);
  font-size: 0.875rem;
}

.tooltip-texto::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -5px;
  border-width: 5px;
  border-style: solid;
  border-color: #333 transparent transparent transparent;
}

.tooltip-container:hover .tooltip-texto {
  visibility: visible;
}

/* ─── 6. Utilitários ────────────────────────────── */
.texto-longo {
  margin-bottom: var(--espaco-md);
}
