/* Base */
:root {
  color-scheme: light dark;
  --brand: #14532d;
  --brand-hover: #0b3b1e;
  --ink: #172019;
  --muted: #4b584e;
  --surface: #ffffff;
  --surface-subtle: #f3f7f3;
  --border: #c4d0c6;
  --focus: #b45309;
  --on-brand: #ffffff;
  --max-width: 72rem;
  --reading-width: 70ch;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  min-width: 20rem;
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
}

img, svg { max-width: 100%; }

a {
  color: var(--brand);
  text-decoration-thickness: 0.12em;
  text-underline-offset: 0.16em;
}

a:hover { color: var(--brand-hover); }

a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
  border-radius: 0.2rem;
}

.container {
  width: min(100% - 2rem, var(--max-width));
  margin-inline: auto;
}

.skip-link {
  position: fixed;
  z-index: 10;
  top: 0.75rem;
  left: 0.75rem;
  transform: translateY(-200%);
  padding: 0.65rem 0.9rem;
  background: var(--ink);
  color: var(--surface);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus { transform: translateY(0); }

/* Header and navigation */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  min-height: 4.5rem;
  padding-block: 0.65rem;
}

.brand {
  color: var(--brand);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.nav, .footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.85rem;
}

.nav a:not(.btn), .footer-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding-inline: 0.2rem;
}

.nav a:not(.btn) { text-decoration: none; }

/* Main content */
main { padding-block: clamp(2.5rem, 7vw, 5rem); }

.hero {
  max-width: var(--reading-width);
  padding-bottom: clamp(3rem, 8vw, 5.5rem);
}

h1, h2, h3 {
  color: var(--ink);
  line-height: 1.15;
  text-wrap: balance;
}

h1 {
  max-width: 18ch;
  margin: 0;
  font-size: clamp(2.15rem, 7vw, 4.25rem);
  letter-spacing: -0.045em;
}

h2 {
  max-width: 28ch;
  margin: 0 0 1.35rem;
  font-size: clamp(1.6rem, 4vw, 2.35rem);
  letter-spacing: -0.03em;
}

h3 {
  margin: 0;
  font-size: 1.125rem;
}

p { margin: 0 0 1.2rem; }

.lead {
  max-width: 65ch;
  margin-top: 1.3rem;
  color: var(--muted);
  font-size: clamp(1.1rem, 2.4vw, 1.3rem);
}

.hero .btn { margin-top: 0.6rem; }

section + section { margin-top: clamp(3.5rem, 8vw, 6rem); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.65rem 1rem;
  border: 2px solid var(--brand);
  border-radius: 0.35rem;
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
}

.btn:hover {
  border-color: var(--brand-hover);
  background: var(--brand-hover);
  color: var(--on-brand);
}

.btn-small {
  min-height: 2.5rem;
  padding: 0.5rem 0.8rem;
  font-size: 0.9375rem;
}

.steps {
  display: grid;
  gap: 1rem;
  max-width: 68rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps > li {
  position: relative;
  min-height: 100%;
  padding: 1.25rem 1.25rem 1.25rem 4.5rem;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  background: var(--surface-subtle);
  counter-increment: step;
}

.steps > li::before {
  position: absolute;
  top: 1.2rem;
  left: 1.2rem;
  display: grid;
  width: 2.25rem;
  height: 2.25rem;
  place-items: center;
  border-radius: 50%;
  background: var(--brand);
  color: var(--on-brand);
  content: counter(step);
  font-weight: 800;
}

.steps p { margin: 0.5rem 0 0; color: var(--muted); }

.features {
  max-width: var(--reading-width);
  margin: 0;
  padding-left: 1.25rem;
}

.features li { padding-left: 0.3rem; }
.features li + li { margin-top: 0.75rem; }

/* Legal prose */
.prose { max-width: var(--reading-width); }
.prose h1 { margin-bottom: 1.5rem; font-size: clamp(2rem, 6vw, 3.25rem); }
.prose h2 { margin-top: 2.7rem; margin-bottom: 1rem; font-size: clamp(1.4rem, 3.5vw, 1.9rem); }
.prose ul { margin: 0 0 1.25rem; padding-left: 1.3rem; }
.prose li + li { margin-top: 0.45rem; }
.prose code {
  padding: 0.1em 0.3em;
  border-radius: 0.2rem;
  background: var(--surface-subtle);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
}

.aviso {
  padding: 1rem 1.1rem;
  border-left: 0.35rem solid #a16207;
  background: #fff7d6;
  color: #463600;
}

.prose table {
  display: block;
  width: 100%;
  margin: 1.5rem 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-collapse: collapse;
  background: var(--surface);
}

.prose caption {
  padding: 0.8rem 0;
  color: var(--muted);
  font-weight: 700;
  text-align: left;
}

.prose th, .prose td {
  min-width: 12rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  vertical-align: top;
  text-align: left;
}

.prose th { background: var(--surface-subtle); }

.dados { margin: 1.25rem 0; }
.dados dt { margin-top: 1rem; font-weight: 800; }
.dados dd { margin: 0.2rem 0 0; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface-subtle);
}

.footer-inner { padding-block: 2rem; }
.footer-nav { margin-bottom: 1rem; }
.footer-note { max-width: var(--reading-width); margin: 0.35rem 0 0; color: var(--muted); font-size: 0.9375rem; }

/* Busca (home e /buscar): so tokens existentes, sem recurso externo */
.busca-form { max-width: var(--reading-width); margin: 1.5rem 0 0; }
.busca-form label { display: block; margin-bottom: 0.4rem; font-weight: 700; }
.busca-linha { display: flex; gap: 0.6rem; }
.busca-linha .btn { flex: none; margin-top: 0; }
input[type="search"] {
  flex: 1;
  min-width: 0;
  min-height: 2.75rem;
  padding: 0.55rem 0.9rem;
  border: 2px solid var(--muted);
  border-radius: 0.5rem;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 1.0625rem;
}
input[type="search"]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.busca-pagina h1 { max-width: none; font-size: clamp(1.75rem, 5vw, 2.5rem); }
.abas { display: flex; flex-wrap: wrap; gap: 1.25rem; margin: 1.5rem 0 1rem; border-bottom: 1px solid var(--border); }
.aba { display: inline-flex; align-items: center; min-height: 2.75rem; padding-inline: 0.2rem; color: var(--muted); font-weight: 700; }
.aba-ativa { color: var(--brand); border-bottom: 3px solid var(--brand); margin-bottom: -1px; }
.aba[aria-disabled="true"] { cursor: not-allowed; }
.resultados { margin: 0; padding: 0; list-style: none; }
.resultado { max-width: var(--reading-width); padding-block: 1rem; border-bottom: 1px solid var(--border); }
.resultado-titulo { font-size: 1.2rem; font-weight: 700; overflow-wrap: anywhere; }
.resultado-dominio { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.9375rem; overflow-wrap: anywhere; }
.resultado-trecho { margin: 0.4rem 0 0; color: var(--ink); overflow-wrap: anywhere; }
.busca-aviso { max-width: var(--reading-width); margin: 1rem 0; padding: 0.9rem 1.1rem; border: 1px solid var(--muted); border-left-width: 6px; border-radius: 0.4rem; background: var(--surface-subtle); }
.busca-aviso h2 { margin: 0 0 0.3rem; font-size: 1.1rem; }
.busca-aviso p { margin: 0; }
.busca-erro { border-style: dashed; border-left-style: solid; }
.busca-dica, .busca-privacidade { max-width: var(--reading-width); color: var(--muted); font-size: 0.9375rem; }
.busca-contagem { margin: 0; font-size: 0.9375rem; color: var(--muted); font-weight: 600; }
@media (max-width: 30rem) {
  .busca-linha { flex-direction: column; }
  .busca-linha .btn { width: 100%; }
}

@media (min-width: 42rem) {
  .steps { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --brand: #4ade80;
    --brand-hover: #86efac;
    --ink: #f1f5f1;
    --muted: #c3d0c5;
    --surface: #101712;
    --surface-subtle: #19231b;
    --border: #526557;
    --focus: #fbbf24;
    --on-brand: #082411;
  }

  .aviso { background: #3b2b05; color: #fff1b8; border-left-color: #fbbf24; }
}
